home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0086_Getting Device Names.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  1KB  |  48 lines

  1. {
  2. From: regis@alpha2.csd.uwm.edu (Joseph William Metcalf)
  3.  
  4. There are been a couple posts looking for a way to read the device name for
  5. CD audio play functions, so here it is (tested under TP7):
  6. }
  7.  
  8. type DRIVELIST=Record
  9.                unitcode:byte;
  10.                doffset,dsegment:word;
  11.                end;
  12.  
  13. var
  14.   CDDL:DriveList;
  15.  
  16. function GetDriverName:string;
  17. var
  18.   CDNTemp:array[1..18] of byte;
  19.   where:pointer;
  20.   count:byte;
  21.   CDSTemp:string[8];
  22. begin
  23.   asm
  24.     mov ax,1501h
  25.     mov bx,OFFSET CDDL
  26.     mov dx,SEG CDDL
  27.     mov es,dx
  28.     int 2fh
  29.   end;
  30.   where:=ptr(CDDL.dsegment,CDDL.doffset);
  31.   move(where^,CDNTEMP,18);
  32.   count:=1;
  33.   repeat
  34.     CDStemp[count]:=chr(cdntemp[10+count]);
  35.     inc(count);
  36.   until (count>8) or (cdntemp[10+count]=32);
  37.   cdstemp[0]:=chr(count-1);
  38.  getdrivername:=cdstemp;
  39. end;
  40. {
  41. This uses the MSCDEX function 1501h (Int 2fh) to read the drivelist and
  42. segment/offset of the device driver header. Device name is 10 bytes into the
  43. header, max 8 characters, padded with spaces if the name is less than 8
  44. characters.
  45. }
  46. begin
  47.   Writeln(GetDriverName);
  48. end.